/*
 * Copyright (c) 2019-2020, https://api.iot.10086.cn/(https://gitee.com/cmcc-iot-api/iot-card-open-application/).
 */
package cn.iot.card.open.sim.service;

import cn.iot.card.open.constants.Constants;
import cn.iot.card.open.constants.ErrorCode;
import cn.iot.card.open.constants.UrlConstants;
import cn.iot.card.open.ec.dto.ResponseDto;
import cn.iot.card.open.modular.model.ResultDTO;
import cn.iot.card.open.modular.token.TokenService;
import cn.iot.card.open.pojo.page.LayuiPageFactory;
import cn.iot.card.open.pojo.page.LayuiPageInfo;
import cn.iot.card.open.sim.dto.siminfo.CardBindingDTO;
import cn.iot.card.open.sim.dto.siminfo.SimApnGprsAlarmDTO;
import cn.iot.card.open.sim.dto.siminfo.SimRealNameRegisterDTO;
import cn.iot.card.open.sim.warpper.CardBindingWrapper;
import cn.iot.card.open.util.ApiRequestUtil;
import cn.iot.card.open.util.CommonUtil;
import cn.iot.card.open.util.JsonUtil;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 物联卡综合信息--安全
 *
 * @author zhanlele
 * @date 20200326 18:46:25
 * @modify 20200326 zhanlele v1.1.2 创建
 * @since v1.1.2
 */
@Slf4j
@Service
public class SimInfoForSecurityService {

    @Autowired
    private TokenService tokenService;

    @Autowired
    private ApiRequestUtil apiRequestUtil;

    public static final String ZERO = "0";

    /**
     * 物联卡机卡分离状态查询
     *
     * @param accountId 账户ID
     * @param transId   流水号
     * @param msisdn    物联卡MSISDN号
     * @param testType  分离检测方式
     * @return 返回 layui page info
     * @throws Exception
     * @author zhanlele
     * @date 20200326 20:24:07
     * @modify 20200326 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    public LayuiPageInfo machineCardSeparateStatus(String accountId, String transId,
                                                   String msisdn, String testType) throws Exception {
        // 调用api接口：先获取token，然后带着token调用api接口
        ResultDTO resultDTO = doRequestMachineCardSeparateStatus(true, accountId, transId, msisdn, testType);
        // 如果此处响应失败即为获取token失败，返回失败原因
        if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
            return LayuiPageFactory.cteateErrorMsg(errorCode);
        }
        // 获取token成功后解析api接口的响应结果
        String responseStr = resultDTO.getMsg();
        String code = CommonUtil.getApiRspCode(responseStr);
        // 获取api接口的响应结果状态码，如果状态码为12021（token不存在或已过期），则重新获取token后再次调用api接口
        if (ErrorCode.ERR12021.getCode().equals(code)) {
            log.warn("[{}] token [accountId:{}] is invalid and start to get a new token.", transId, accountId);
            resultDTO = doRequestMachineCardSeparateStatus(false, accountId, transId, msisdn, testType);
            // 如果此处响应失败即为获取token失败，返回失败原因
            if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
                ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
                return LayuiPageFactory.cteateErrorMsg(errorCode);
            }
            // 获取token成功后，重置responseStr（api接口的响应结果）
            responseStr = resultDTO.getMsg();
        }

        ResponseDto<Map<String, Object>> response = JsonUtil.parseJson(responseStr,
                new TypeReference<ResponseDto<Map<String, Object>>>(){});
        code = response.getStatus();
        if (!ErrorCode.SUCCESS.getCode().equals(code)) {
            // 如果api接口返回失败，则返回失败原因
            log.warn("[{}] query SingleCardOnlineInfo error, error message is {}.", transId, response.getMessage());
            return LayuiPageFactory.cteateErrorMsg(ErrorCode.getByCode(code));
        }

        List<Map<String, Object>> resultList = response.getResult();
        Page<Map<String, Object>> page = LayuiPageFactory.defaultPage();
        page.setTotal(resultList.size());
        page.setRecords(resultList);

        page = new CardBindingWrapper(page).wrap();
        return LayuiPageFactory.createPageInfo(page);
    }

    /**
     * 调API，物联卡机卡分离状态查询
     *
     * @param tokenValid token是否有效
     * @param accountId  账号ID
     * @param transId    流水号
     * @param msisdn     物联卡msisdn号
     * @param testType   分离检测方式
     * @return 返回 result dto
     * @throws Exception
     * @author zhanlele
     * @date 20200326 18:48:36
     * @modify 20200326 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    private ResultDTO doRequestMachineCardSeparateStatus(boolean tokenValid, String accountId, String transId,
                                                         String msisdn, String testType) throws Exception {
        ResultDTO tokenResultDTO = tokenService.getToken(tokenValid, accountId);
        if (!tokenResultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            return tokenResultDTO;
        }

        Map<String, String> parameterMap = new HashMap<>();
        parameterMap.put(Constants.REQUEST_PARAM_TOKEN, tokenResultDTO.getMsg());
        parameterMap.put(Constants.REQUEST_PARAM_TRANSID, transId);
        parameterMap.put(Constants.REQUEST_PARAM_MSISDN, msisdn);
        parameterMap.put(Constants.TEST_TYPE, testType);

        String methodUrl = apiRequestUtil.buildRequestUrl(parameterMap, UrlConstants.QUERY_CARD_BIND_STATUS);
        log.info("[{}] machineCardSeparateStatus request url is {}.", transId, methodUrl);

        tokenResultDTO.setMsg(apiRequestUtil.doGet(methodUrl));
        return tokenResultDTO;
    }

    /**
     * 机卡绑定（话单侧）
     *
     * @param accountId      账户ID
     * @param transId        流水号
     * @param cardBindingDTO
     * @return 返回 response data
     * @throws Exception
     * @author zhanlele
     * @date 20200326 22:40:22
     * @modify 20200326 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    public ResponseData cardBind(String accountId, String transId, CardBindingDTO cardBindingDTO) throws Exception {
        // 调用api接口：先获取token，然后带着token调用api接口
        ResultDTO resultDTO = doRequestCardBind(true, accountId, transId, cardBindingDTO);
        // 如果此处响应失败即为获取token失败，返回失败原因
        if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
            throw new ServiceException(Integer.valueOf(errorCode.getCode()), errorCode.getMsg());
        }
        // 获取token成功后解析api接口的响应结果
        String responseStr = resultDTO.getMsg();
        String code = CommonUtil.getApiRspCode(responseStr);
        // 获取api接口的响应结果状态码，如果状态码为12021（token不存在或已过期），则重新获取token后再次调用api接口
        if (ErrorCode.ERR12021.getCode().equals(code)) {
            log.warn("[{}] token [accountId:{}] is invalid and start to get a new token.", transId, accountId);
            resultDTO = doRequestCardBind(false, accountId, transId, cardBindingDTO);
            // 如果此处响应失败即为获取token失败，返回失败原因
            if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
                ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
                throw new ServiceException(Integer.valueOf(errorCode.getCode()), errorCode.getMsg());
            }
            // 获取token成功后，重置responseStr（api接口的响应结果）
            responseStr = resultDTO.getMsg();
        }

        ResponseDto responseDto = JsonUtil.parseJson(responseStr, new TypeReference<ResponseDto>(){});
        code = responseDto.getStatus();
        if (ErrorCode.SUCCESS.getCode().equals(code)) {
            return ResponseData.success();
        } else {
            // 如果api接口返回失败，则返回失败原因
            log.warn("[{}] cardBindForCdr error, error message is {}.", transId, responseDto.getMessage());
            ResponseData responseData = new ResponseData();
            responseData.setCode(Integer.valueOf(code));
            responseData.setMessage(responseDto.getMessage());
            return responseData;
        }
    }

    /**
     * 调API，单卡机卡绑定/变更/解绑（话单侧、网络侧）
     *
     * @param tokenValid     token是否有效
     * @param accountId      账户ID
     * @param transId        流水号
     * @param cardBindingDTO
     * @return 返回 result dto
     * @throws Exception
     * @author zhanlele
     * @date 20200326 22:33:36
     * @modify 20200326 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    private ResultDTO doRequestCardBind(boolean tokenValid, String accountId, String transId,
                                              CardBindingDTO cardBindingDTO) throws Exception {
        ResultDTO tokenResultDTO = tokenService.getToken(tokenValid, accountId);
        if (!tokenResultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            return tokenResultDTO;
        }

        Map<String, String> parameterMap = new HashMap<>();
        parameterMap.put(Constants.REQUEST_PARAM_TOKEN, tokenResultDTO.getMsg());
        parameterMap.put(Constants.REQUEST_PARAM_TRANSID, transId);
        String bindFor = cardBindingDTO.getBindFor();
        String cardType = cardBindingDTO.getCardType();
        String cardNum = cardBindingDTO.getCardNum();
        String operType = cardBindingDTO.getOperType();
        String bindingStyle = cardBindingDTO.getBindingStyle();
        String tac = cardBindingDTO.getTac();
        String imei = cardBindingDTO.getImei();
        switch (cardType) {
            case Constants.REQUEST_PARAM_MSISDN:
                parameterMap.put(Constants.REQUEST_PARAM_MSISDN, cardNum);
                break;
            case Constants.REQUEST_PARAM_ICCID:
                parameterMap.put(Constants.REQUEST_PARAM_ICCID, cardNum);
                break;
            case Constants.REQUEST_PARAM_IMSI:
                parameterMap.put(Constants.REQUEST_PARAM_IMSI, cardNum);
                break;
        }
        parameterMap.put(Constants.REQUEST_PARAM_OPERTYPE, operType);

        String url = "";
        if (ZERO.equals(bindFor)) {
            url = UrlConstants.OPERATE_CDR_CARD_BINDING;
            parameterMap.put(Constants.TAC_VALUE, tac);
            parameterMap.put(Constants.BINDING_STYLE, bindingStyle);
        } else {
            url = UrlConstants.OPERATE_NET_CARD_BINDING;
            parameterMap.put(Constants.RESPONSE_IMEI, imei);
        }

        String methodUrl = apiRequestUtil.buildRequestUrl(parameterMap, url);
        log.info("[{}] cardBind request url is {}.", transId, methodUrl);

        tokenResultDTO.setMsg(apiRequestUtil.doGet(methodUrl));
        return tokenResultDTO;
    }

    /**
     * 物联卡实名登记
     *
     * @param accountId              账户ID
     * @param transId                流水号
     * @param userPic                用户现场人像图片
     * @param idCardPicFace          用户身份证芯片头像图片
     * @param idCardPicFront         用户身份证正面图片
     * @param idCardPicBack          用户身份证反面图片
     * @param simRealNameRegisterDTO
     * @return 返回 response data
     * @throws Exception
     * @author zhanlele
     * @date 20200329 11:20:00
     * @modify 20200329 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    public ResponseData simRealNameRegister(String accountId, String transId, MultipartFile userPic, MultipartFile idCardPicFace,
                                            MultipartFile idCardPicFront, MultipartFile idCardPicBack,
                                            SimRealNameRegisterDTO simRealNameRegisterDTO) throws Exception {
        // 封装调用api接口的参数
        Map<String, String> paramMap = prepareSimRegisterParam(userPic, idCardPicFace, idCardPicFront, idCardPicBack,
                simRealNameRegisterDTO);
        // 调用api接口：先获取token，然后带着token调用api接口
        ResultDTO resultDTO = doRequestSimRealNameRegister(true, accountId, transId, paramMap);
        // 如果此处响应失败即为获取token失败，返回失败原因
        if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
            throw new ServiceException(Integer.valueOf(errorCode.getCode()), errorCode.getMsg());
        }
        // 获取token成功后解析api接口的响应结果
        String responseStr = resultDTO.getMsg();
        String code = CommonUtil.getApiRspCode(responseStr);
        // 获取api接口的响应结果状态码，如果状态码为12021（token不存在或已过期），则重新获取token后再次调用api接口
        if (ErrorCode.ERR12021.getCode().equals(code)) {
            log.warn("[{}] token [accountId:{}] is invalid and start to get a new token.", transId, accountId);
            resultDTO = doRequestSimRealNameRegister(false, accountId, transId, paramMap);
            // 如果此处响应失败即为获取token失败，返回失败原因
            if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
                ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
                throw new ServiceException(Integer.valueOf(errorCode.getCode()), errorCode.getMsg());
            }
            // 获取token成功后，重置responseStr（api接口的响应结果）
            responseStr = resultDTO.getMsg();
        }

        ResponseDto<Map<String, String>> responseDto = JsonUtil.parseJson(responseStr,
                new TypeReference<ResponseDto<Map<String, String>>>(){});
        code = responseDto.getStatus();
        if (ErrorCode.SUCCESS.getCode().equals(code)) {
            return ResponseData.success(JsonUtil.toJson(responseDto.getResult()));
        } else {
            // 如果api接口返回失败，则返回失败原因
            log.warn("[{}] simRealNameRegister error, error message is {}.", transId, responseDto.getMessage());
            ResponseData responseData = new ResponseData();
            responseData.setCode(Integer.valueOf(code));
            responseData.setMessage(responseDto.getMessage());
            return responseData;
        }
    }

    /**
     * 物联卡实名认证，准备请求参数
     *
     * @param userPic                用户现场人像图片
     * @param idCardPicFace          用户身份证芯片头像图片
     * @param idCardPicFront         用户身份证正面图片
     * @param idCardPicBack          用户身份证背面图片
     * @param simRealNameRegisterDTO
     * @return 返回 map
     * @throws Exception
     * @author zhanlele
     * @date 20200327 16:26:17
     * @modify 20200327 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    private Map<String, String> prepareSimRegisterParam(MultipartFile userPic, MultipartFile idCardPicFace,
                                                        MultipartFile idCardPicFront, MultipartFile idCardPicBack,
                                                        SimRealNameRegisterDTO simRealNameRegisterDTO) throws Exception {
        String userPicStr = new String(Base64.encodeBase64(userPic.getBytes()));
        String idCardPicFaceStr = new String(Base64.encodeBase64(idCardPicFace.getBytes()));
        String idCardPicFrontStr = new String(Base64.encodeBase64(idCardPicFront.getBytes()));
        String idCardPicBackStr = new String(Base64.encodeBase64(idCardPicBack.getBytes()));
        simRealNameRegisterDTO.setUserPicStr(userPicStr);
        simRealNameRegisterDTO.setIdCardPicFaceStr(idCardPicFaceStr);
        simRealNameRegisterDTO.setIdCardPicFrontStr(idCardPicFrontStr);
        simRealNameRegisterDTO.setIdCardPicBackStr(idCardPicBackStr);
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put(Constants.REQUEST_PARAM_MSISDN, simRealNameRegisterDTO.getMsisdn());
        paramMap.put(Constants.REQUEST_PARAM_ICCID, simRealNameRegisterDTO.getIccid());
        paramMap.put(Constants.ID_NAME, simRealNameRegisterDTO.getIdName());
        paramMap.put(Constants.ID_NO, simRealNameRegisterDTO.getIdNo());
        paramMap.put(Constants.ID_ADDR, simRealNameRegisterDTO.getIdAddr());
        paramMap.put(Constants.ID_VALIDDATE, simRealNameRegisterDTO.getIdValiddate());
        paramMap.put(Constants.ID_EXPDATE, simRealNameRegisterDTO.getIdExpdate());
        paramMap.put(Constants.GENDER, simRealNameRegisterDTO.getGender());
        paramMap.put(Constants.NATION, simRealNameRegisterDTO.getNation());
        paramMap.put(Constants.BIRTHDAY, simRealNameRegisterDTO.getBirthday());
        paramMap.put(Constants.CUST_PHONE_NO, simRealNameRegisterDTO.getCustPhoneNo());
        paramMap.put(Constants.ISSUING_AUTHORITY, simRealNameRegisterDTO.getIssuingAuthority());
        paramMap.put(Constants.PIC_TYPE, simRealNameRegisterDTO.getPicType());
        paramMap.put(Constants.USER_PIC, userPicStr);
        paramMap.put(Constants.CARD_PIC_FACE, idCardPicFaceStr);
        paramMap.put(Constants.CARD_PIC_FRONT, idCardPicFrontStr);
        paramMap.put(Constants.CARD_PIC_BACK, idCardPicBackStr);
        return paramMap;
    }

    /**
     * 调API，物联卡实名登记
     *
     * @param tokenValid token是否有效
     * @param accountId  账户ID
     * @param transId    流水号
     * @param paramMap
     * @return 返回 result dto
     * @throws Exception
     * @author zhanlele
     * @date 20200329 11:21:19
     * @modify 20200329 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    private ResultDTO doRequestSimRealNameRegister(boolean tokenValid, String accountId, String transId,
                                                   Map<String, String> paramMap) throws Exception {
        ResultDTO tokenResultDTO = tokenService.getToken(tokenValid, accountId);
        if (!tokenResultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            return tokenResultDTO;
        }

        paramMap.put(Constants.REQUEST_PARAM_TOKEN, tokenResultDTO.getMsg());
        paramMap.put(Constants.REQUEST_PARAM_TRANSID, transId);

        String methodUrl = apiRequestUtil.buildRequestUrl(null, UrlConstants.REGISTER_REAL_NAME_SIM);
        log.info("[{}] simRealNameRegister request url is {}.", transId, methodUrl);

        tokenResultDTO.setMsg(apiRequestUtil.doPost(methodUrl, paramMap));
        return tokenResultDTO;
    }

    /**
     * 物联卡APN流量告警设置
     *
     * @param accountId          账户ID
     * @param transId            流水号
     * @param simApnGprsAlarmDTO
     * @return 返回 response data
     * @throws Exception
     * @author zhanlele
     * @date 20200329 18:22:23
     * @modify 20200329 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    public ResponseData simApnGprsAlarm(String accountId, String transId, SimApnGprsAlarmDTO simApnGprsAlarmDTO) throws Exception {
        // 调用api接口：先获取token，然后带着token调用api接口
        ResultDTO resultDTO = doRequestSimApnGprsAlarm(true, accountId, transId, simApnGprsAlarmDTO);
        // 如果此处响应失败即为获取token失败，返回失败原因
        if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
            throw new ServiceException(Integer.valueOf(errorCode.getCode()), errorCode.getMsg());
        }
        // 获取token成功后解析api接口的响应结果
        String responseStr = resultDTO.getMsg();
        String code = CommonUtil.getApiRspCode(responseStr);
        // 获取api接口的响应结果状态码，如果状态码为12021（token不存在或已过期），则重新获取token后再次调用api接口
        if (ErrorCode.ERR12021.getCode().equals(code)) {
            log.warn("[{}] token [accountId:{}] is invalid and start to get a new token.", transId, accountId);
            resultDTO = doRequestSimApnGprsAlarm(false, accountId, transId, simApnGprsAlarmDTO);
            // 如果此处响应失败即为获取token失败，返回失败原因
            if (!resultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
                ErrorCode errorCode = ErrorCode.getByCode(resultDTO.getCode());
                throw new ServiceException(Integer.valueOf(errorCode.getCode()), errorCode.getMsg());
            }
            responseStr = resultDTO.getMsg();
        }
        // 获取token成功后，重置responseStr（api接口的响应结果）
        ResponseDto<Map<String, String>> responseDto = JsonUtil.parseJson(responseStr,
                new TypeReference<ResponseDto<Map<String, String>>>(){});
        code = responseDto.getStatus();
        if (ErrorCode.SUCCESS.getCode().equals(code)) {
            return ResponseData.success(responseDto.getResult().get(0));
        } else {
            // 如果api接口返回失败，则返回失败原因
            log.warn("[{}] simApnGprsAlarm error, error message is {}.", transId, responseDto.getMessage());
            ResponseData responseData = new ResponseData();
            responseData.setCode(Integer.valueOf(code));
            responseData.setMessage(responseDto.getMessage());
            return responseData;
        }
    }

    /**
     * 调API，物联卡APN流量告警设置
     *
     * @param tokenValid         token是否有效
     * @param accountId          账户ID
     * @param transId            流水号
     * @param simApnGprsAlarmDTO
     * @return 返回 result dto
     * @throws Exception
     * @author zhanlele
     * @date 20200329 18:19:15
     * @modify 20200329 zhanlele v1.1.2 创建
     * @since v1.1.2
     */
    private ResultDTO doRequestSimApnGprsAlarm(boolean tokenValid, String accountId, String transId,
                                               SimApnGprsAlarmDTO simApnGprsAlarmDTO) throws Exception {
        ResultDTO tokenResultDTO = tokenService.getToken(tokenValid, accountId);
        if (!tokenResultDTO.getCode().equals(ErrorCode.SUCCESS.getCode())) {
            return tokenResultDTO;
        }

        Map<String, String> paramMap = new HashMap<>();
        paramMap.put(Constants.REQUEST_PARAM_TOKEN, tokenResultDTO.getMsg());
        paramMap.put(Constants.REQUEST_PARAM_TRANSID, transId);
        paramMap.put(Constants.REQUEST_PARAM_MSISDNS, simApnGprsAlarmDTO.getMsisdns());
        paramMap.put(Constants.REQUEST_PARAM_OPERTYPE, simApnGprsAlarmDTO.getOperType());
        paramMap.put(Constants.REQUEST_PARAM_APNNAME, simApnGprsAlarmDTO.getApnName());
        paramMap.put(Constants.REQUEST_PARAM_APNTYPE, simApnGprsAlarmDTO.getApnType());
        String level1Str = simApnGprsAlarmDTO.getLevel1();
        String level2Str = simApnGprsAlarmDTO.getLevel2();
        String level3Str = simApnGprsAlarmDTO.getLevel3();
        if (StringUtils.isNotBlank(level1Str)) {
            paramMap.put(Constants.REQUEST_PARAM_LEVEL1, level1Str);
        }
        if (StringUtils.isNotBlank(level2Str)) {
            paramMap.put(Constants.REQUEST_PARAM_LEVEL2, level2Str);
        }
        if (StringUtils.isNotBlank(level3Str)) {
            paramMap.put(Constants.REQUEST_PARAM_LEVEL3, level3Str);
        }

        String methodUrl = apiRequestUtil.buildRequestUrl(paramMap, UrlConstants.LIMIT_SIM_APN_GPRS);
        log.info("[{}] simApnGprsAlarm request url is {}.", transId, methodUrl);

        tokenResultDTO.setMsg(apiRequestUtil.doGet(methodUrl));
        return tokenResultDTO;
    }
}
